﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EmptyBullet : MonoBehaviour
{
    public GameObject thronBullet;
    public CharacterController CharCollider;
    public CapsuleCollider CapsuleCollider;
   public GameObject temp;
    public void Start()
    {
        StartCoroutine(Shot());
        
    }

    public IEnumerator Shot()
    {
        yield return new WaitForSeconds(0.04f);
        temp =Instantiate(thronBullet, transform.position, transform.rotation);      
        
        if (gameObject.GetComponent<Bullet>().CapsuleCollider != null)
        {
            temp.GetComponent<Thorn>().CapsuleCollider = this.gameObject.GetComponent<Bullet>().CapsuleCollider;
        }
        else if (gameObject.GetComponent<Bullet>().CharCollider != null)
        {
            temp.GetComponent<Thorn>().CharCollider = this.gameObject.GetComponent<Bullet>().CharCollider;
        }
        yield return StartCoroutine(Shot());
    }
   
}
